package com.hmall.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.hmall.item.pojo.Item;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ItemMapper extends BaseMapper<Item> {
    @Select("select * from tb_item")
    Page<Item> pageQuery();

    @Update("update tb_item set status=#{status} where id=#{id}")
    void change(Integer id, Integer status);

    @Select("select * from tb_item")
    List<Item> fenye();

    @Select("select * from tb_item")
    List<Item> page(Integer page, Integer size);

    @Update("update tb_item set stock=#{num} where id=#{itemId}")
    void changenum(Long itemId, Integer num);
}
